local skill = fk.CreateSkill{
  name = "doom_pact_skill",
}

Fk:loadTranslationTable{
  [skill.name] = "末日契约",

  ["#doom_pact_skill"] = "所有角色弃置所有牌。结算完成后，移除所有死亡骑士牌。"
}

skill:addEffect("cardskill", {
  prompt = "#doom_pact_skill",
  can_use = Util.GlobalCanUse,
  on_use = function (self, room, effect)
    local player = effect.from
    if not effect.tos or #effect.tos == 0 then
      effect.tos = table.filter(room:getAlivePlayers(), function (p)
        return not player:isProhibited(p, effect.card)
      end)
    end
    room.logic:getCurrentEvent():addExitFunc(
      function ()
        local death_knight_list = { "frostmourne", "anti_magic_shell", "army_of_the_dead", "death_and_decay", "death_coil", "death_grip", "doom_pact", "obliterate" }
        local death_knights = table.filter(Fk:getAllCardIds(), function (id)
          return table.contains(death_knight_list, Fk:getCardById(id).name)
        end)
        room:moveCardTo(death_knights, Card.Void, nil, fk.ReasonJustMove, "doom_pact", nil, true, player)
      end
    )
  end,
  on_effect = function (self, room, effect)
    local to = effect.to
    room:throwCard(to:getCardIds("he"), "doom_pact", to, to)
  end,
})

return skill